import java.util.*; // ArrayList, TreeSet

public class CourseListTester {

    public static void main(String [] args) {

		TreeSet<Course> testList = new TreeSet<Course>();

		// Create a course list, reading from CourseList.txt		
		testList = CourseList.readCourseList("CourseList.txt");
	
		// Display info for each course in the list
		System.out.println("List of courses is the following:");
		for (Course c : testList) {
			System.out.println(c.getCourseInfo());
		}
		
		// Register a student in each course that's not already full
		System.out.println("Adding a student to each course with seats available...");
		for (Course c : testList) {
			if (!c.isCourseFull()) {
				c.registerStudent();
			}
		}
		
		// Display info for each course in the list
		System.out.println("Updated course info:");
		for (Course c : testList) {
			System.out.println(c.getCourseInfo());
		}
		
		// Write out a modified course file
		System.out.println("Writing updated course info to ModifiedCourseList.txt");
		CourseList.writeCourseList(testList, "ModifiedCourseList.txt");
	}
}
